<?php

$config = [
    'components' => [
        'request' => [
            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
            'cookieValidationKey' => 'JtRD5iJ_5yifqaJBaq10sT0hOKEwHfOz',
        ],
        'formatter' => [
            'locale' => 'zh-CN',
            'nullDisplay' => '',
            'timeZone' => 'Asia/Shanghai',
            'defaultTimeZone' => 'Asia/Shanghai',
            'timeFormat' => 'php:H:i:s',
            'dateFormat' => 'php:Y-m-d',
            'datetimeFormat' => 'php:Y-m-d H:i:s',
            //'thousandSeparator' => ''
        ],
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            //'enableStrictParsing' => true,
            'rules' => [
                'posts/<year:\d{4}>' => 'post/index',

                '/' => 'yii2/site/home',
                [
                    'class' => 'yii\web\GroupUrlRule',
                    'prefix' => 'v1',
                    'routePrefix' => 'yii2',
                    'rules' => [
                        'device/remove' => 'site/remove',
                    ],
                ],
                [
                    'class' => 'yii\web\UrlRule',
                    'pattern' => '/about',
                    'route' => '/site/contact',
                    'verb' => ['GET'],
                    'suffix' => '.html',
                    'mode' => \yii\web\UrlRule::PARSING_ONLY, // 只在解析请求中使用
                    //'host' => 'http://localhost:20080'
                ],
//                [
//                    'class' => 'yii\rest\UrlRule',
//                    'controller' => ['device' => 'yii2/site', 'api'],
//                    'prefix' => 'v1',
//                    'pluralize' => true,
//                    'tokens' => [
//                        '{id}' => '<id:\\d[\\d,]*>',
//                        '{mac}' => '<mac:[0-9a-fA-F]{12}>'
//                    ],
//                    'extraPatterns' => [
//                        'remove/{mac}' => 'remove',
//                    ]
//                ],
                '<app>/<level1>/<level2>/<level3>' => 'yii2/<app>/level3',
            ]
        ],
        'security' => [
            'derivationIterations' => 1000000,
        ],
        'assetManager' => [
            'appendTimestamp' => true
            //'linkAssets' => true
//            'assetMap' => [
//                'css/bootstrap.css' => '@web/css/boostrap3.css',
//            ]
//            'bundles' => [
//                'yii\bootstrap\BootstrapAsset' => [
//                    'css' => [
//                        'css/bootstrap.css',
//                        '/css/boostrap3.css'
//                    ],
//                ],
//            ],
        ]
    ],
    'aliases' => [
        //'@route' => '/@frontend/controllers',
    ],

];

// configuration adjustments for 'dev' environment
//$config['bootstrap'][] = 'debug';
//$config['modules']['debug'] = [
//    'class' => 'yii\debug\Module',
//    'allowedIPs' => ['*']
//];
if(YII_ENV_DEV){
    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = [
        'class' => 'yii\gii\Module',
        'allowedIPs' => ['*']
    ];
    $config['components']['assetManager']['linkAssets'] = true;
}


return $config;
